Week Tasks

1 Download a project

There are two main ways to download a project to your computer from GitHub and you should pick the one that makes sense for what you want to do:

1.1 Download a .zip package

The most straightforward method is to download a .zip file containing the latest version of the files.

Click on the green ‘Code’ button, then the ‘Download ZIP’ option. This will download a single file, archived and compressed using the common ZIP file format. Double-clicking the file will extract its contents to a folder next to the original .zip file.

An important distinction here is that you are downloading just the codebase — the files and folders of the repository — and not the Git repository itself. This means you lose some of the key functionality of Git, for example, if the project maintainers make any updates to the project, you will need to manually re-download the .zip file and extract it again to see those changes, instead of being able to easily pull these changes (more on this in the next example!).

1.2 Clone

Another way to download a project to your computer is to use Git’s clone method. To use clone, we need to tell Git installed on our computer to make a copy (or ‘clone’) of another repository, in this case from GitHub.

First, we need to copy the address of the repository we want to clone.

  1. Click on the green button labelled “Code”

  2. Choose either HTTPS or SSH, depending on how you connect to GitHub with Git on your computer (see the Configuration section of Unit 1)

  3. Copy the address

Then in your terminal, navigate to your desired folder and issue the following command:

git clone <address>

You should now see the repository has been cloned to your computer.

First, navigate to the repository you want to clone on the GitHub website.

  1. Click on the green button labelled ‘Code’

  2. Click on ‘Open with GitHub Desktop’

  3. You should then see a window like this pop up in GitHub Desktop:

  1. The URL of the repository on GitHub has automatically been populated

  2. Choose where you would like the repository to be cloned to on your computer

  3. Click ‘Clone’

Using this approach, we have a copy of the files and folders in the repository, but we have also copied the metadata which makes this into a Git repository. To answer the example above, now if a project maintainer makes an update to the project on GitHub, we can easily sync both versions:

In the project folder just issue the pull command:

git pull

On GitHub Desktop, click the ‘Fetch origin’ button in the top bar:

1.3 Create a new GitHub repository for your group project

To create a new GitHub repository we can either:

  1. Create a local repo and the push it (see notes)
  2. Create a repo and GitHub and the clone it as we did on Task 1.2.

Lets look at the second approach. First, navigate to you GitHub profile and click on Repositories. Then click on New :

Then add a sensible name for your repo and configure it:

Once you have created this repo you can clone it to your local machine (see Task 1.2).